home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 30 / PC Gamer IT CD 30 1-2.iso / MOTS / GAMEDATA / RESOURCE / JKMRES.GOO / cog_class_boxturret4.cog < prev    next >
Text File  |  1998-02-25  |  2KB  |  94 lines

  1. # Jedi Knight Cog Script
  2. #
  3. # CLASS_BOXTURRET4.COG
  4. #
  5. # Class COG for a turret
  6. #
  7. # Alternate the firepoint between two points.
  8. #
  9. # [YB]
  10. #
  11. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  12.  
  13.  
  14. symbols
  15.  
  16. template    powerup=+dEnergyCell             local
  17. thing       newThing                         local
  18. int         player                           local
  19.  
  20. #message    fire
  21. #message    created
  22. message     killed                           mask=0xfff
  23. message     skill
  24. message     damaged
  25.  
  26. end
  27.  
  28. # ========================================================================================
  29.  
  30. code
  31.  
  32. //created:
  33. // SetThingFireOffset(GetSenderRef(), '0.2 0.0 0.0');
  34. // SetThingUserData(GetSenderRef(), 0);
  35. // Return;
  36.  
  37. # ........................................................................................
  38.  
  39. //fire:
  40. // if(GetThingUserData(GetSenderRef()) == 0)
  41. // {
  42. //    SetThingFireOffset(GetSenderRef(), '-0.2 0.0 0.0');
  43. //     SetThingUserData(GetSenderRef(), 1);
  44. // }
  45. // else
  46. // {
  47. //      SetThingFireOffset(GetSenderRef(), '0.2 0.0 0.0');
  48. //      SetThingUserData(GetSenderRef(), 0);
  49. // }
  50. //
  51. // Return;
  52.  
  53. # ........................................................................................
  54.  
  55. killed:
  56.    rval = Rand();
  57.    if(rval < 0.2)
  58.    {
  59.       newThing = CreateThing(powerup, GetSenderRef());
  60.       SetLifeleft(newThing, 200.0);
  61.    }
  62.  
  63.    Return;
  64.  
  65. # ........................................................................................
  66.  
  67. skill:
  68.    ReturnEx(-1);
  69.    Return;
  70.  
  71. # ........................................................................................
  72.  
  73. damaged:
  74.    if(GetParam(1) == 1) ReturnEx(0);         // turrets immune to impact damage
  75.  
  76.    player = GetLocalPlayerThing();
  77.  
  78.    if(GetThingParent(GetSourceRef()) == player)
  79.    {
  80.       if(GetCurWeapon(player) == 1)
  81.       {
  82.          if(GetThingHealth(player) > 1)
  83.          {
  84.             DamageThing(player, 1, 0x1, player);
  85.          }
  86.       }
  87.    }
  88.  
  89.    Return;
  90.  
  91. end
  92.  
  93.  
  94.